/** @ingroup keyboard
 * @file keycodes.h
 * @brief scancode to keycode mappings 
 *
 * maps recognized scancodes to keycodes. keycode labels are oriented at a
 * german qwertz keyboard.
 *
 * @author cameris camerisdump@gmail.com
 */

/** @name keyboard compile time option
 * @{ */
#define CAPS_TO_ESC 1 /**< @brief maps caps to esc, for the vim users :-P */
/**@} */

/** @brief scancode to keycode */
struct codemap{
	uint8_t scancode;
	uint8_t keycode;
};

/** @brief sorted keycodes */
enum keycodes { /* {{{ */
	NO_KEYCODE, /**< @brief empty keycode */
	KC_A,
	KC_B,
	KC_C,
	KC_D,
	KC_E,
	KC_F,
	KC_G,
	KC_H,
	KC_I,
	KC_J,
	KC_K,
	KC_L,
	KC_M,
	KC_N,
	KC_O,
	KC_P,
	KC_Q,
	KC_R,
	KC_S,
	KC_T,
	KC_U,
	KC_V,
	KC_W,
	KC_X,
	KC_Y,
	KC_Z,
	KC_O_DIAERESIS,
	KC_A_DIAERESIS,
	KC_U_DIAERESIS,
	LAST_CAPS_EFFECTED, /**< @brief marks the end of caps effected */
	KC_KP_0,
	KC_KP_1,
	KC_KP_2,
	KC_KP_3,
	KC_KP_4,
	KC_KP_5,
	KC_KP_6,
	KC_KP_7,
	KC_KP_8,
	KC_KP_9,
	KC_KP_COMMA,
	LAST_NUM_EFFECTED, /**< @brief marks the end of num effected */
	KC_0,
	KC_1,
	KC_2,
	KC_3,
	KC_4,
	KC_5,
	KC_6,
	KC_7,
	KC_8,
	KC_9,
	KC_INSERT,
	KC_END,
	KC_HOME,
	KC_PGUP,
	KC_PGDOWN,
	KC_DELETE,
	KC_LEFT,
	KC_RIGHT,
	KC_UP,
	KC_DOWN,
	KC_PRINT,
	KC_ESC,
	KC_CIRCUMFLEX,
	KC_APOSTROPHE,
	KC_BACKSPACE,
	KC_TAB,
	KC_PLUS,
	KC_NUMBERSIGN,
	KC_ENTER,
	KC_LESS,
	KC_COMMA,
	KC_POINT,
	KC_MINUS,
	KC_SPACE,
	KC_SCROLL,
	KC_SHARP_S,
	KC_KP_PLUS,
	KC_KP_MINUS,
	KC_KP_MULTIPLY,
	KC_KP_DIVISION,
	KC_KP_ENTER,
	KC_F1,
	KC_F2,
	KC_F3,
	KC_F4,
	KC_F5,
	KC_F6,
	KC_F7,
	KC_F8,
	KC_F9,
	KC_F10,
	KC_F11,
	KC_F12,
	KC_ALT,
	KC_ALTGR,
	KC_NUM,
	KC_CAPS,
	KC_LSHIFT,
	KC_RSHIFT,
	KC_LCTRL,
	KC_RCTRL,
}; /* }}} */

/** @brief normal scancodes */
const __flash struct codemap keycode_map[] = { /* {{{ */
	{0x76, KC_ESC},
	{0x05, KC_F1},
	{0x06, KC_F2},
	{0x04, KC_F3},
	{0x0C, KC_F4},
	{0x03, KC_F5},
	{0x0B, KC_F6},
	{0x83, KC_F7},
	{0x0A, KC_F8},
	{0x01, KC_F9},
	{0x09, KC_F10},
	{0x78, KC_F11},
	{0x07, KC_F12},
	{0x0E, KC_CIRCUMFLEX},
	{0x16, KC_1},
	{0x1E, KC_2},
	{0x26, KC_3},
	{0x25, KC_4},
	{0x2E, KC_5},
	{0x36, KC_6},
	{0x3D, KC_7},
	{0x3E, KC_8},
	{0x46, KC_9},
	{0x45, KC_0},
	{0x4E, KC_SHARP_S},
	{0x55, KC_APOSTROPHE},
	{0x66, KC_BACKSPACE},
	{0x0D, KC_TAB},
	{0x15, KC_Q},
	{0x1D, KC_W},
	{0x24, KC_E},
	{0x2D, KC_R},
	{0x2C, KC_T},
	{0x35, KC_Z},
	{0x3C, KC_U},
	{0x43, KC_I},
	{0x44, KC_O},
	{0x4D, KC_P},
	{0x54, KC_U_DIAERESIS},
	{0x5B, KC_PLUS},
	{0x5D, KC_NUMBERSIGN},
	{0x1C, KC_A},
	{0x1B, KC_S},
	{0x23, KC_D},
	{0x2B, KC_F},
	{0x34, KC_G},
	{0x33, KC_H},
	{0x3B, KC_J},
	{0x42, KC_K},
	{0x4B, KC_L},
	{0x4C, KC_O_DIAERESIS},
	{0x52, KC_A_DIAERESIS},
	{0x5A, KC_ENTER},
	{0x61, KC_LESS},
	{0x1A, KC_Y},
	{0x22, KC_X},
	{0x21, KC_C},
	{0x2A, KC_V},
	{0x32, KC_B},
	{0x31, KC_N},
	{0x3A, KC_M},
	{0x41, KC_COMMA},
	{0x49, KC_POINT},
	{0x4A, KC_MINUS},
	{0x29, KC_SPACE},
	{0x7E, KC_SCROLL},
	{0x79, KC_KP_PLUS},
	{0x7B, KC_KP_MINUS},
	{0x7C, KC_KP_MULTIPLY},
	{0x11, KC_ALT},
	{0x77, KC_NUM},
#if CAPS_TO_ESC == 1
	{0x58, KC_ESC},
#else
	{0x58, KC_CAPS},
#endif
	{0x12, KC_LSHIFT},
	{0x59, KC_RSHIFT},
	{0x14, KC_LCTRL},
	{0x70, KC_KP_0},
	{0x69, KC_KP_1},
	{0x72, KC_KP_2},
	{0x7A, KC_KP_3},
	{0x6B, KC_KP_4},
	{0x73, KC_KP_5},
	{0x74, KC_KP_6},
	{0x6C, KC_KP_7},
	{0x75, KC_KP_8},
	{0x7D, KC_KP_9},
	{0x71, KC_KP_COMMA},
{0,0}}; /* }}} */

/** @brief extended scancodes */
const __flash struct codemap keycode_e0_map[] = { /* {{{ */
	{0x5A, KC_KP_ENTER},
	{0x4A, KC_KP_DIVISION},
	{0x69, KC_END},
	{0x6B, KC_LEFT},
	{0x6C, KC_HOME},
	{0x70, KC_INSERT},
	{0x71, KC_DELETE},
	{0x72, KC_DOWN},
	{0x74, KC_RIGHT},
	{0x75, KC_UP},
	{0x7A, KC_PGDOWN},
	{0x7D, KC_PGUP},
	{0x11, KC_ALTGR},
	{0x14, KC_RCTRL},
	{0x7C, KC_PRINT},
{0,0}}; /* }}} */

/* vim:set foldmethod=marker: */
